/**   
 * @Title: AccountDetailListActGroup.java 
 * @Package: com.esun.rabbit2.viewer.mainact.mylotteryact.accountdetail 
 * @Description: TODO(账户明细列表activity group) 
 * @Author: Billy qigs@500wan.com   
 * @Date: 2011-7-27 下午04:43:20  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.viewer.mainact.mylotteryact.accountdetail;

import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

import com.esun.config.Config;
import com.esun.ui.R;

/**
 * @ClassName: AccountDetailListActGroup
 * @Description: TODO(账户明细列表activity group)
 * @Author: Billy qigs@500wan.com
 * @Date: 2011-7-27 下午04:43:20
 */
public class AccountDetailListActGroup extends ActivityGroup implements OnClickListener {

	private TabHost accountDetailTabHost;
	private ImageButton btnBack;
	private RadioButton rbAll;
	private RadioButton rbLottery;
	private RadioButton rbCharge;
	private RadioButton rbAward;
	private RadioButton rbWithdraw;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.accountdetail_actgroup);

		initUI();
	}


	public void initUI() {

		accountDetailTabHost = (TabHost) findViewById(R.id.accountdetail_act_group_tabhost);
		accountDetailTabHost.setup(getLocalActivityManager());

		// 全部账户明细
		TabSpec totalAccountDetail = accountDetailTabHost
				.newTabSpec("Total_Account_Detail");
		totalAccountDetail.setIndicator("0");
		totalAccountDetail.setContent(new Intent(this, TotalListAct.class));
		accountDetailTabHost.addTab(totalAccountDetail);

		// 购彩账户明细
		TabSpec lotterylAccountDetail = accountDetailTabHost
				.newTabSpec("Lottery_Account_Detail");
		lotterylAccountDetail.setIndicator("1");
		lotterylAccountDetail.setContent(new Intent(this, LotteryListAct.class));
		accountDetailTabHost.addTab(lotterylAccountDetail);

		// 充值账户明细
		TabSpec chargeAccountDetail = accountDetailTabHost
				.newTabSpec("Charge_Account_Detail");
		chargeAccountDetail.setIndicator("2");
		chargeAccountDetail.setContent(new Intent(this, ChargeListAct.class));
		accountDetailTabHost.addTab(chargeAccountDetail);

		// 派奖账户明细
		TabSpec awardAccountDetail = accountDetailTabHost
				.newTabSpec("Award_Account_Detail");
		awardAccountDetail.setIndicator("3");
		awardAccountDetail.setContent(new Intent(this, AwardsListAct.class));
		accountDetailTabHost.addTab(awardAccountDetail);

		// 提款账户明细
		TabSpec withdrawalAccountDetail = accountDetailTabHost
				.newTabSpec("Withdrawal_Account_Detail");
		withdrawalAccountDetail.setIndicator("4");
		withdrawalAccountDetail
				.setContent(new Intent(this, WithdrawListAct.class));
		accountDetailTabHost.addTab(withdrawalAccountDetail);

		accountDetailTabHost.setCurrentTab(0);

		rbAll = (RadioButton) findViewById(R.id.accountdetail_act_group_rb_all);
		rbAll.setOnClickListener(this);

		rbLottery = (RadioButton) findViewById(R.id.accountdetail_act_group_rb_lottery);
		rbLottery.setOnClickListener(this);

		rbCharge = (RadioButton) findViewById(R.id.accountdetail_act_group_rb_charge);
		rbCharge.setOnClickListener(this);

		rbAward = (RadioButton) findViewById(R.id.accountdetail_act_group_rb_award);
		rbAward.setOnClickListener(this);

		rbWithdraw = (RadioButton) findViewById(R.id.accountdetail_act_group_rb_withdrawal);
		rbWithdraw.setOnClickListener(this);
		
		btnBack = (ImageButton)findViewById(R.id.accountdetail_act_group_btn_back);
		btnBack.setOnClickListener(this);
		
	}
	

	public static boolean isCanClick = true;
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		Message msg = new Message();
		msg.what = Config.DO_REFRESH;
		
		switch (v.getId()) {
		case R.id.accountdetail_act_group_rb_all:

			if(isCanClick){
				accountDetailTabHost.setCurrentTab(0);
				TotalListAct.accountDetailHandler.sendMessage(msg);
				isCanClick = false;
			}

			break;

		case R.id.accountdetail_act_group_rb_lottery:

			if(isCanClick){
				accountDetailTabHost.setCurrentTab(1);
				LotteryListAct.accountDetailHandler.sendMessage(msg);	
				isCanClick = false;
			}

			break;

		case R.id.accountdetail_act_group_rb_charge:

			if(isCanClick){
				accountDetailTabHost.setCurrentTab(2);
				ChargeListAct.accountDetailHandler.sendMessage(msg);
				isCanClick = false;
			}

			break;

		case R.id.accountdetail_act_group_rb_award:

			if(isCanClick){
				accountDetailTabHost.setCurrentTab(3);
				AwardsListAct.accountDetailHandler.sendMessage(msg);
				isCanClick = false;
			}

			break;

		case R.id.accountdetail_act_group_rb_withdrawal:

			if(isCanClick){
				accountDetailTabHost.setCurrentTab(4);
				WithdrawListAct.accountDetailHandler.sendMessage(msg);
				isCanClick = false;
			}

			break;

		case R.id.accountdetail_act_group_btn_back:

			AccountDetailListActGroup.this.finish();

			break;
		}
	}
}
